﻿#ifndef PLCWORKER_H
#define PLCWORKER_H

#include <QObject>
#include "Common/common.h"
#include <QtSerialPort>
#include <QSerialPortInfo>
class PlcWorker : public QObject
{
    Q_OBJECT
public:
    explicit PlcWorker(QObject *parent = nullptr);
    ~PlcWorker();
    bool m_bPlcConnect;
    PlcInfo m_coPlcInfo;
    QSerialPort *m_serialPort;
    void sendInfo(QByteArray sendBuf);

    void readPlcInfo(SIG_PLC nSig);
    void writePlcInfo(SIG_PLC nSig, int nIndex);
    void writePlcInfo(SIG_PLC nSig, float nIndex);

    void splitFloat(float fIndex,int& nIndex1,int& nIndex2);
    int m_nSig = 0;
    QByteArray byReadBuf;




    int m_nENCODER = 0;
    int m_nMOTOR1_REV = 0;

signals:
public slots :
    void receiveInfo();
    void Initialize();
    void start();
};

#endif // PLCWORKER_H
